package com.xjm.entity.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author xjm
 * @since 2025-03-03
 */
@Data
@TableName("orders")
public class OrdersModel implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 订单号
     */
    private String orderNo;

    private Integer userId;

    private Integer addressId;

    /**
     * 订单总金额
     */
    private BigDecimal totalAmount;

    @TableField(exist = false)
    private String logisticsNo;

    @TableField(exist = false)
    private List<OrderItemsModel> orderItems;

    /**
     * pending/processing/shipped/completed/cancelled
     */
    private String status;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(fill = FieldFill.UPDATE)
    private Date updatedTime;
}
